<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" session="false" %><%@
include file="/WEB-INF/jspf/import.jspf" %><%--
--%><!doctype HTML>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
        <title>我的车友会 </title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <meta name="author" content="lijun_gz none" />
        <link rel="stylesheet" type="text/css" href="http://js.3conline.com/wap/pcauto/2013/admin/style.css"/>
    </head>
    <body class="g-doc">
         <jsp:include page="/template/wap/common/counter.jspf">
            <jsp:param name="channel" value="7472" />
        </jsp:include>
        <div class="body">
            <div class="g-hd">
                <a href="${UCWAPROOT}/" class="header-back"></a>
                <div class="header-title">
                    <span class="header-title-home">我的车友会</span>
                </div>
            </div>

            <div class="m-huodong" id="Jhuodong">
                <span class="m-huodong-span"></span>
                <script src="http://www.pcauto.com.cn/forum/club/active/1404/intf3307.js" charset="GBK"></script>
            </div>

            <div class="m-cylist" id="JcyList"><%--车友会信息 --%></div>
            <div class="m-cybg"><img src="http://www1.pcauto.com.cn/wap/g20140509/cyh/img/myclub_bg.png"></div>

            <script type="text/javascript" src="http://js.3conline.com/wap/2013/common/js/zepto1.1.min.js" ></script>
            <script><%--要放在footer前面--%>
                function touchEvent(elm,fn) {    
                    elm.addEventListener("click",fn,false);    
                }
			
                // 空回调函数
                function aFunc(data) {}
		
                var hd = document.getElementById('Jhuodong'),
                hdSpan = hd.querySelector('.m-huodong-span'),
                hdHeight = hd.clientHeight,
                cylist = document.getElementById('JcyList');
                hd.style.height = '37px';
			    
                touchEvent(hdSpan,function () {
                    if (hd.className == 'm-huodong') {
                        hd.style.height = hdHeight + 'px';
                        hd.className = 'm-huodong m-huodongA';
                        cylist.style.marginTop = '47px';
                    } else {
                        hd.style.height = '37px';
                        setTimeout(function(){
                            cylist.style.marginTop = '10px';
                            hd.className = 'm-huodong';
                        }, 100);
                    }
                });
			    
                $.ajax({
                        type: 'POST',
                    url: "${ROOT}/club/getClubByUIdOrRegionId.do?req_enc=utf-8&resp_enc=utf-8&_t="+new Date().getTime()+"&isMine=1&userId=${user.uid}",
                    dataType: 'jsonp',
                    jsonpCallback:'aFunc',
                    success: function(data) {
                        var $html = '';
                        if (data.message == undefined) {
                            var clubs = data.data;
                            if(clubs!=null && clubs!=undefined){
                                    for (var i = 0; i < clubs.length; i++) {
                                    $html += "<div class='m-cylist-item'><a href='${WAPROOT}/"+clubs[i].clubUrl+"'><div class='m-cylist-pictext'>" 
                                        + "<img src='" + (clubs[i].logo ? clubs[i].logo : 'http://www1.pcauto.com.cn/wap/g20140509/cyh/img/holder_186x120.jpg') + "' width='93' height='60' />"
                                        + "<div class='m-cylist-text'><p>" + clubs[i].name + "</p>"
                                        + "<span><i>会员：" + clubs[i].memberSum + "人</i> <i>油值：" 
                                        + clubs[i].totalPetrol + "L</i></span>"
                                        + "<span><i>排名：" + (clubs[i].level == 0 ? '--' : (clubs[i].rank == 0 ? '--' : clubs[i].rank)) 
                                            + "</i> 等级：<i class='star'><em style='width:" + clubs[i].level*20 + "%'></em></i></span>"
                                        + "</div></div></a></div>";
                                }

                            }else{
                                $html = "<div class=\"m-none\"><span>  >_< lll</span><p>抱歉，您还没有加入车友会哦~</p></div>";
                            }
			    			
                        } else {
                            $html = "<div class=\"m-none\"><span>  >_< lll</span><p>抱歉，您还没有加入车友会哦~</p></div>";
                        }
                        $('#JcyList').html($html);
                        setHeight();
                    }
                });
			    
                /**满屏函数*/
                function setHeight(){
                    var Jfoot = document.querySelector(".g-footer");
                    var Jbody = document.querySelector(".body");
                    if (!Jfoot) return;
                    if (!Jbody) return;
                    var webHeight = document.documentElement.clientHeight,
                    JbodyHeight = Jbody.clientHeight;
                    if (JbodyHeight < webHeight) {
                        Jbody.style.height = webHeight + "px";
                        Jbody.style.position = "relative";
                        Jfoot.setAttribute("style", "width:100%;position:absolute;bottom:0px;");
                    }else{
                        Jfoot.style.position = "relative";
                    }
                }
            </script>
            <div class="g-footer">
               <%@include file="../common/intf5987.html" %>
            </div>
        </div>
    </body>
</html>